sprintf(errorMessage,"appletalkingStartup: POpenSkt() error %d, can't allocate a DDP socket!",(int) errCode);
ErrorAlert(errorMessage);
goto EXITPOINT;
}
ddpSocketOpened = true;
if (myMPPPB.DDP.socket != MYGAMEDDPSOCKETNUMBER)
{
sprintf(errorMessage,"appletalkingStartup: POpenSkt() opened socket #%d when asked to open #%d!",(int) myMPPPB.DDP.socket,(int) MYGAMEDDPSOCKETNUMBER);
if (errCode != noErr || otherPlayerATPPBPtrs[i] == nil)
{
sprintf(errorMessage,"appleTalkingConnectToOpponents: NewPtr() error %d, cannot allocate ATPParamBlock #%d for use in sending ATP Requests!",(int) errCode,(int) i);
if (errCode != noErr || otherPlayerBDSPtrs[i] == nil)
{
sprintf(errorMessage,"appleTalkingConnectToOpponents: NewPtr() error %d, cannot allocate BDS #%d for use in sending ATP Requests!",(int) errCode,(int) i);
if (errCode != noErr || otherPlayerRespBuffPtrs[i] == nil)
{
sprintf(errorMessage,"appleTalkingConnectToOpponents: NewPtr() error %d, cannot allocate response buffer #%d for use in sending ATP Requests!",(int) errCode,(int) i);
goto EXITPOINT;
}
}
// allocate storage for all the names we'll be looking up
sprintf(errorMessage,"appleTalkingConnectToOpponents: NewPtr() error %d, cannot allocate nbpNamesBuffer for use in looking up NBP names!",(int) errCode);
sprintf(errorMessage,"appleTalkingConnectToOpponents: PSendRequest() error %d, can't get status of newly-found player '%s'",(int) errCode,(char *) &(otherPlayerNames[numOtherPlayers]));
sprintf(errorMessage,"appleTalkingConnectToOpponents: PSendRequest() error %d, can't confirm status of known player '%s'",(int) errCode,(char *) &(otherPlayerNames[i]));
sprintf(errorMessage,"appleTalkingConnectToOpponents: after PKillSendReq(), ioResult for SendRequest #%d is %d",(int) i,(int) ((*((ATPParamBlock *) otherPlayerATPPBPtrs[i])).ATP.ioResult));
ErrorAlert(errorMessage);
errCode = noErr;
}
}
DisposePtr(otherPlayerATPPBPtrs[i]);
otherPlayerATPPBPtrs[i] = nil;
}
if (otherPlayerBDSPtrs[i] != nil)
{
DisposePtr(otherPlayerBDSPtrs[i]);
otherPlayerBDSPtrs[i] = nil;
}
if (otherPlayerRespBuffPtrs[i] != nil)
{
DisposePtr(otherPlayerRespBuffPtrs[i]);
otherPlayerRespBuffPtrs[i] = nil;
}
}
// dispose of storage
if (nbpNamesBuffer != nil)
{
DisposePtr(nbpNamesBuffer);
nbpNamesBuffer = nil;
}
if (theDPtr != nil)
{
DisposDialog(theDPtr);
theDPtr = nil;
}
if (oldPort != nil)
{
SetPort(oldPort);
}
return(errCode);
}
// The ATP completion routine handler in C
static void ATPReceiveCompletionC(unsigned long A5,ATPParamBlock * theRequestATPPB)